This invention relates to an improvement of a control device for a sewing machine which operates under the control of a microcomputer.
With reference to FIGS. 6-8, the machinery and a control device of a conventional sewing machine will be described. FIG. 6 shows the machinery of the sewing machine, and FIG. 7 shows a control circuit in which a multiprocessor-type numerically controlled device, of a type such as that disclosed in Japanese Unexamined Patent Publication No. Sho. 61-296407, is employed as the control device of a sewing machine.
In FIG. 6, reference numeral 11 designates a sewing machine which accommodates a mechanism for stitching an article to be sewed thereon. This sewing machinery 11, disposed on a table 12, is provided with a needle bar 13 for stitching an article, a needle position detector 13a for detecting the position of the needle bar 13, and a cloth presser foot 17 for holding the article between an upper presser bar 15 and a lower presser bar 16 in a pressed manner. This cloth presser foot 17, which is located on a bed slide 18, is provided with an XY table 19 which feeds the article to be stitched in the XY plane, and origin detectors 20a and 20b for detecting the mechanical origin of the XY table 19.
An operation panel 22, on which various types of switch are provided for setting the operation of the sewing machine, is disposed on the upper surface of a control box 10. This operation panel 22 is provided with a liquid crystal display (hereinafter referred to as an LCD) 24 for displaying stitching conditions, and switches 27 for various purposes. A floppy disk (hereinafter referred to as an FD) 34 is inserted as a fourth memory element into an FD read/write section 30 formed in the front surface of the control box 10. A foot pedal 31 is provided at a lower part of the control box 10. This foot pedal 31 has a start switch 32 for providing a sewing start instruction and a cloth press switch 33 for causing the cloth presser foot 17 to hold cloth in a pressed manner.
FIG. 7 shows a control circuit housed in the control box 10 which controls the sewing machine. The control circuit has a main microcomputer 1 which serves as a first microcomputer, a servo microcomputer 2a which acts as a second microcomputer for controlling a servo motor 21, and a table microcomputer 2b for controlling pulse motors 19a and 19b which drive the XY table 19. The main microcomputer 1 is arranged so as to issue a control instruction to the servo microcomputer 2a and the table microcomputer 2b.
The main microcomputer 1 is connected to a ROM 52 which holds a start program, or the like, a RAM 50 which holds data regarding the number of stitches and a needle stroke necessary for creating a desired sewing pattern, and a nonvolatile rewritable flash memory 51 which acts as a first memory element.
As shown in FIG. 8, the memory contents of this flash memory includes programs 100, 101, and 102 for controlling the main microcomputer 1, the servo microcomputer 2a, and the table microcomputer 2b, display data 103 of the LCD 24 provided in the operation panel 22, parameters 104 of a plurality of blocks which consist of a scaling factor for sewing data and feeding action data, and a plurality of blocks of sewing data 105.
Each of the servo microcomputer 2a and the table microcomputer 2b may be provided with a specialized ROM which holds the start program or the like, and a specialized flash memory which holds a control program or the like. However, an increase in the number of memory devices complicates control, thereby resulting in a large-sized circuit board. To avoid such an increase in the size of the board, the present invention employs a control circuit having the configuration shown in FIG. 7.
The main microcomputer 1 is connected to the servo microcomputer 2a via an arbitration circuit 60a which arbitrates between rights (i.e., access rights) of the main microcomputer 1 and the servo microcomputer 2a. Similarly, the main microcomputer 1 is connected to the table microcomputer 2b via an arbitration circuit 60b. Interface RAMs 62a and 62b are connected to and controlled by the arbitration circuits 62a and 60b. The interface RAMs 60a and 62b transfer the memory contents of the flash memory 51 and exchange data between the main microcomputer 1 and the servo microcomputer 2a (or the table microcomputer 2b). Here, the interface RAM 62a is referred to as a second memory element.
The main microcomputer 1 is connected to an address latch 55a and a decoder 56a. The servo microcomputer 2a is connected to a RAM 63a which serves as a third memory element, and the table microcomputer 2b is connected to a RAM 63b and a decoder 56b.
The main microcomputer 1 is connected to the operation panel 22 via an interface 22a, the FD read/write section 30 via an FD control device 30c, and a reset circuit 70 which provides a reset instruction to the main microcomputer 1. The servo microcomputer 2a is connected to the servo motor 21 via a drive circuit 21b, and to a solenoid 17a which drives the cloth presser foot 17 via a drive circuit 17b. The table microcomputer 2b is connected to the needle position detector 13a via an interface 13c, the origin detectors 20a and 20b via an interface 20c, the pulse motors 19a and 19b, which drive the XY table 19, via a drive circuit 19c, and the foot pedal 31 via an interface 31a.
With reference to FIGS. 6 and 7, the operation of the control device of the sewing machine will be described. When the power for the control circuit of the sewing machine is turned on, the reset circuit 70 releases the main microcomputer 1 from its reset state, and the program stored in the ROM 52 is executed. Control programs 101 and 102 stored in the flash memory 51 are transferred to and stored in the interface RAMs 62a and 62b using the arbitration circuits 60a and 60b. Thereafter, the control programs are further transferred respectively to the RAMs 63a and 63b from the interface RAMs 62a and 62b. After the completion of the transfer of the programs, the main microcomputer 1 activates the servo microcomputer 2a and the table microcomputer 2b by releasing them from the reset state.
When stitching is started by pressing the start switch 32, the servo microcomputer 2a drives a servomotor via the drive circuit 21b and actuates the needle bar 13, as well as driving the solenoid 17a and actuating the cloth presser foot 17 via the drive circuit 17b, according to the control programs or the like stored in the RAM 63a. At the same time, the table microcomputer 2b sequentially reads the sewing data stored in the RAM 63b, and activates the drive circuit 19a based on the sewing data and the angle read by the needle position detector 13a. The table microcomputer 2b further drives the pulse motors 19a and 19b and causes the needle bar 13 to stitch the article to be stitched by moving the XY table 19 to a desired position based on the speed detected by the drive circuit 21b and a speed instruction from the RAM 63b.
If the stitching is carried out by changing the sewing data, new sewing data are input to the controller using the switches 27 of the operation panel 22, or the sewing data stored in the FD 34 are read by the control device.
With the previously mentioned configuration of the control device of the conventional sewing machine, if the servo microcomputer 2a generates an interrupt for the purpose of improving the controllability of the servomotor 21 while the main microcomputer 1 has the right to use the interface RAM 62a, neither the memory contents of the interface RAM 62a where a start address of the interrupt request is situated, nor the memory contents of the RAM 63a, can be read, which makes it impossible to control the servo microcomputer 2a. The servo microcomputer 2a is a one-chip microcomputer, and an execution start address and an interrupt start address coexist in the memory area of the interface RAM 62a because the execution start address and the interrupt start address, which starts interrupt processing when an interrupt is generated, are very close to each other. Accordingly, if the servomotor 2a generates an interrupt while the main microcomputer 1 has the right to use the interface RAM 62a, it is impossible to read the interrupt address of the interface RAM 62a.
When the control program or the like of the flash memory 51 is to be altered, a language to be used for that purpose cannot be selected. Hence, the alteration of the control program can be troublesome, depending on its content.
The control program or the like is stored in the rewritable flash memory 51. Since the flash memory is rewritable, the memory contents of the flash memory may occasionally need to be rewritten for some reason, thereby causing an interruption in the control of the sewing machine.
The present invention is conceived to solve the first problem, and an object of the invention is to provide a control device for use in a sewing machine and a control method which enable the memory contents of a memory element to be read when a servo-microcomputer generates an interrupt.
The present invention is also conceived to solve the second problem, and accordingly another object of the invention is to provide a control device for use in a sewing machine which can change sewing data by specifying a rewriting format when sewing data are changed.
The present invention further is conceived to solve the third problem, and hence yet another object of the invention is to provide a control device for use in a sewing machine which can automatically detect the rewriting of the memory contents of a rewritable memory element due to noise, and can restore the memory contents to their original state before they have actually been rewritten.